from log_interpreters import GetAllEntries
from log_parser import LogParser

log = LogParser().ParseFile('log')

entries = GetAllEntries(log, lambda x: x['event'] == 'YIELD_TO_PAGE_LOAD')

waiting_time = reduce(lambda x,y: x + y, map(lambda x: x['end'] - x['start'], entries), 0)
print('%sms spent waiting for pages to load' % waiting_time)
